@extends('layouts.supervisor')

@section('content')

<style type="text/css">
.delegate{margin:10px;}
</style>
<div class="page-content">
    <div class="page-header">
        <h1>{{$title}}</h1>
    </div>
    <div class="row">
        <div class="col-xs-12">
            <div class="row form-horizontal">
                <label class="col-xs-12 col-sm-2 control-label no-padding-right alert alert-block alert-success"> 所有版本论文</label>
                <div class="col-xs-12 col-sm-6" style="margin-top:0px; margin-left:5px;background:#f5f5f5">
                    <div id="profile-feed-1" class="profile-feed">
                        @foreach($history as $item)
                        <div class="profile-activity clearfix">
                            <div>
                                
                                <a class="user" href="/download/papers/{{$item->paper}}">{{$item->paper}}  
                                @if($item->by_supervisor)
                                <span class="label label-warning arrowed arrowed-right">@if($item->current)最新版@endif 导师提交</span>
                                @else
                                <span class="label label-success arrowed-in arrowed-in-right">@if($item->current)最新版@endif 学生提交</span> 
                                @endif
                                </a>
                                <div class="time">
                                    <i class="icon-time bigger-110" style="margin-right:5px;"></i>提交时间: {{$item->created_at}} 
                                   <p style="word-wrap:break-word"><i class="icon-comment bigger-110" style="margin-right:5px;"></i>说明: {{$item->comment}}</p>
                                </div>
                            </div>
                        </div>
                        @endforeach
                    </div>
                </div>
            </div>
            <div class="hr hr16 hr-double"></div>
            <div class="row form-horizontal">
               <label class="alert alert-block alert-success col-xs-12 col-sm-2 control-label no-padding-right"> {{$who}} </label>
                 <div class="form-actions col-xs-12 col-sm-6" style="margin-top:0px; margin-left:5px;">
                    <form id="title-form" name="title-form" class="form-horizontal" method="POST" action="/supervisor/thesis/{{$action}}" >
                        {{ csrf_field() }}
                        <input type="hidden" class="col-xs-10 col-sm-5" id='student' name="student" value="{{$student->id}}" />

                        <div class="space-4"></div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right" for="form-input-readonly"> 评语 </label>
                            <div class="col-sm-9">
                               <textarea class="form-control" rows="10" id="content" name="content" placeholder="请输入不少于50字评语">
                                @if ($action == "supervise_comment") 
                                    @if($student->supervise_comment)
					{{$student->supervise_comment->content}}
				    @endif
                                @elseif ($action == "review_comment")
                                    @if($student->review_comment){{$student->review_comment->content}}@endif
                                @else
                                     @if($student->defense_comment){{$student->defense_comment->content}}@endif
                                @endif
                                </textarea>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right" for="form-input-readonly"> 分数 </label>
                            <div class="col-sm-9">
                                @if ($action == "supervise_comment") 
                                   
                                    <input class="form-control" value="@if($student->supervise_comment) {{$student->supervise_comment->grade}}@endif" id="grade" name="grade" placeholder="请输入分数（整数）"></input>
                                @elseif ($action == "review_comment")
                                    <input class="form-control" value="@if($student->review_comment) {{$student->review_comment->grade}}@endif" id="grade" name="grade" placeholder="请输入分数（整数）"></input>
                                @else
                                    <input class="form-control" value="@if($student->defense_comment) {{$student->defense_comment->grade}}@endif" id="grade" name="grade" placeholder="请输入分数（整数）"></input>
                                @endif

                            </div>
                        </div>


                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right" for="form-input-readonly">  </label>
                            <div class="col-sm-9">
                                <button class="btn btn-info btn-sm" type="button" onclick="event.preventDefault(); document.getElementById('title-form').submit();">
                                    <i class="icon-ok bigger-110"></i>
                                    确认
                                </button>
                            </div>
                            @if (count($errors) > 0)
                            <div class="hr hr16 hr-dotted"></div>
                            <div class="space-4"></div>
                            <div class="alert alert-danger">
                                <ul>
                                    @foreach ($errors->all() as $error)
                                    <li>{{ $error }}</li>
                                    @endforeach
                                </ul>
                            </div>
                            @endif
                        </div>

                       
                    </form>
                </div>
            </div>
        </div>
    </div>

</div>

<script type="text/javascript">
    @if($history->count() > 0)
    $('#profile-feed-1').slimScroll({
        height: '150px',
        alwaysVisible : false
    });
    @endif
</script>
@endsection



